VERSION 5.00
Begin VB.Form FindFiles 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Personal File Search"
   ClientHeight    =   3600
   ClientLeft      =   3975
   ClientTop       =   1905
   ClientWidth     =   7515
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   3600
   ScaleWidth      =   7515
   Visible         =   0   'False
   Begin VB.Timer Update 
      Interval        =   100
      Left            =   6960
      Top             =   3360
   End
   Begin VB.TextBox CurrentlyScanning 
      Height          =   285
      Left            =   0
      TabIndex        =   6
      Text            =   "CurrentlyScanning"
      Top             =   3360
      Width           =   5055
   End
   Begin VB.TextBox DriveToScan 
      Height          =   285
      Left            =   6450
      TabIndex        =   4
      Text            =   "DriveToScan (ex: C:\)"
      Top             =   60
      Width           =   1035
   End
   Begin VB.CommandButton Find 
      Caption         =   "Search"
      Height          =   255
      Left            =   3840
      TabIndex        =   3
      Top             =   75
      Width           =   885
   End
   Begin VB.TextBox SearchPattern 
      Height          =   285
      Left            =   1200
      TabIndex        =   1
      Text            =   "SearchPattern"
      Top             =   45
      Width           =   2520
   End
   Begin VB.ListBox Results 
      Height          =   2985
      Left            =   30
      TabIndex        =   0
      Top             =   360
      Width           =   7455
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Starting Point"
      Height          =   195
      Left            =   5430
      TabIndex        =   5
      Top             =   90
      Width           =   945
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Search Pattern"
      Height          =   195
      Left            =   60
      TabIndex        =   2
      Top             =   90
      Width           =   1065
   End
End
Attribute VB_Name = "FindFiles"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


'Code by Chizl <chizl@karland.com>
'15 minute code time.
'Karland International
'Copyrighted (c) 1999
'Public Domain as long as this header is attached.

'This does not search Hidden Directories!!!!

Dim lStop As Boolean

Dim ScanningFolder As String

Private Sub GetListing(strDir$, strFile$)
On Error Resume Next
    Dim varrDir As Variant
    Dim ivarrCount

    Dim strFileName$
    Dim strDirName$
    
    Do While Right(strDir$, 2) = "\\"
        If lStop Then GoTo ExitOut
        strDir$ = Mid(strDir$, 1, Len(strDir$) - 1)
        DoEvents
    Loop
    
    ScanningFolder = strDir$
    
    strDirName$ = Dir(strDir$, vbDirectory)
    Do While strDirName$ = "." 'Or strDirName$ = ".."
        If lStop Then GoTo ExitOut
        strDirName$ = Dir()
        DoEvents
    Loop
    ivarrCount = 1
    
    ReDim varrDir(ivarrCount) As Variant
    Do While strDirName$ <> ""
        If lStop Then GoTo ExitOut
        DoEvents
        If LCase(strDirName$) = LCase(strFile$) Then
            Results.AddItem strDir$ & strDirName$
        End If
        
        If InStr(strDirName$, ".") = 0 Then
            varrDir(ivarrCount) = strDirName$
            ivarrCount = UBound(varrDir) + 1
            ReDim Preserve varrDir(ivarrCount) As Variant
        End If
        
        strDirName$ = Dir()
    Loop
    
    strFileName$ = Dir(strDir$ & strFile$)
    
    Do While strFileName$ <> ""
        If lStop Then GoTo ExitOut
'        ScanningFolder = strDir$ & strFileName$
        
        DoEvents
        Results.AddItem strDir$ & strFileName$
        strFileName$ = Dir()
    Loop
    
    For i = 1 To UBound(varrDir)
        If lStop Then GoTo ExitOut
        DoEvents
        If varrDir(i) = "" Then Exit For
        GetListing strDir$ & CStr(varrDir(i)) & "\", strFile$
    Next
    
ExitOut:

End Sub

Sub CurrentlyScanning_Change()

End Sub

Sub Find_Click()
    If Find.Caption = "Search" Then
        If Right(DriveToScan, 1) <> "\" Then DriveToScan = DriveToScan & "\"
        
        Results.Clear
        
        Find.Caption = "Stop"
        GetListing DriveToScan, SearchPattern
        
        lStop = False
        Find.Caption = "Search"
        ScanningFolder = "Done.."
    Else
        lStop = True
        Find.Caption = "Search"
    End If
    ScanningFolder = ""
End Sub

Private Sub Form_Load()
ScanningFolder = ""
End Sub


Sub Results_Click()

End Sub

Sub SearchPattern_Change()

End Sub

Sub Update_Timer()
CurrentlyScanning.Text = ScanningFolder
End Sub


